<div class="row">
	<h2>Filter Peer Reviews</h2>
	<form action="<?php echo site_url('admin/peer_reviews'); ?>" method="POST">
		<label for="group_id">Group</label>
		<select name="group_id" id="group_id">
			<option value="">All Groups</option>
			<?php foreach($groups as $key => $group ) : ?>
				<option value="<?php echo $group['group_id']; ?>"><?php echo $group['group_name']; ?></option>
			<?php endforeach; ?>
		</select>

		<br>

		<label for="user_id">Student</label>
		<select name="user_id" id="user_id">
			<option value="">All Students</option>
			<?php foreach($students as $key => $student ) : ?>
				<option value="<?php echo $student['user_id']; ?>"><?php echo $student['first_name'] . ' ' . $student['last_name']; ?></option>
			<?php endforeach; ?>
		</select>

		<br>

		<label for="assessment_id">Assessment Item</label>
		<select name="assessment_id" id="assessment_id">
			<option value="">All Assessments</option>
			<?php foreach($assessments as $key => $assesment ) : ?>
				<option value="<?php echo $assesment['assessment_id']; ?>"><?php echo $assesment['assessment_title']; ?></option>
			<?php endforeach; ?>
		</select>

		<br>

		<label for="week_no">Week Number</label>
		<select name="week_no" id="week_no">
			<option value="">All Weeks</option>
			<?php for ($i=1; $i <= $week_limit; $i++) : ?>
				<option value="<?php echo $week_offset + $i; ?>"><?php echo $i; ?></option>
			<?php endfor; ?>
		</select>

		<br>

		<input type="submit" value="Filter Peer Reviews">

	</form>
</div>

<table>
	
	<tr>
		<th>Group Name</th>
		<th>Review For</th>
		<th>Assessment</th>
		<th>Week Number</th>
		<th>Grade</th>
	</tr>

	<?php if ( is_array($peer_reviews) ) : ?>
	<?php foreach ($peer_reviews as $review) : ?>
		<tr>
			<td><?php echo $review['group_name']; ?></td>
			<td><?php echo $review['first_name'] . ' ' . $review['first_name']; ?></td>
			<td><?php echo $review['assessment_title']; ?></td>
			<td><?php echo $review['week_no'] - $week_offset; ?></td>
			<td><?php echo $review['result']; ?></td>
		</tr>
	<?php endforeach ?>
	<?php else : ?>
	<p>No peer reviews found.</p>
	<?php endif; ?>

</table>